<script setup lang="ts">
import { defineProps, defineEmits} from 'vue'
import {changeStr} from "@/config";
const {} = defineProps<{
  width?:string|number,
  height?:string|number,
  title?:string,
  label?:string,
  emotion?:string,
  emoji?:any,
  blurb?:string,
  background?:string|null
}>()
const emit = defineEmits<{
  click: [key?: string|number]
}>()
const onClick = () => {
  emit('click')
}
</script>

<template>
  <div class="card-f" @click="onClick()" :style="{width:changeStr(width)||'181px',height:changeStr(height)||'120px'}">
      <div class="content-f">
        <div class="name">{{ title || '文件夹未命名' }}</div>
        <div class="handle">{{ label || '标签未设置' }}</div>
        <div class="title">
          <p v-if="!!emotion" style="margin: 0">
            <span class="emoji">{{emoji || '😊'}}</span> {{ emotion }}<br />
          </p>
          {{ blurb || '暂无简介'}}
        </div>
      </div>
      <div class="dots orange-dots"></div>
      <div class="dots pink-dots"></div>
    </div>
</template>

<style scoped lang="scss">
.card-f {
  width: auto;
  height: auto;
  background-color: rgba(221, 190, 246, 0.7);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  position: relative;
  border: 3px solid #000;
  //box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
  box-shadow 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
}

.card-f:hover {
  transform: translateZ(12px) rotateX(1deg) rotateY(-1deg);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.card-f .content-f {
  background: transparent;
  height: auto;
  padding: 20px 10px 0;
}

.card-f .name {
  font-size: 18px;
  font-weight: bold;
  margin: 20px 0 5px;
}

.card-f .handle {
  position: absolute;
  top: 0;
  right: 20px;
  background-color: rgba(168, 113, 227);
  padding: 7px 12px;
  border-radius: 0 0 15px 15px;
  border: 2px solid #000;
  border-top: none;
  font-weight: bold;
}

.card-f .title {
  color: #4a4a4a;
  font-size: 12px;
}

.card-f .emoji {
  font-size: 24px;
}

.card-f::before {
  content: "";
  position: absolute;
  //top: -50%;
  //left: -50%;
  width: 120%;
  height: 120%;
  background: linear-gradient(
          to bottom right,
          rgba(255, 255, 255, 0.3),
          rgba(255, 255, 255, 0) 80%
  );
  //transform: rotate(-30deg);
  pointer-events: none;
}

.card-f .name,
.card-f .title {
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.card-f:hover .name {
  transform: translateZ(30px);
}

.card-f:hover .title {
  transform: translateZ(20px);
}

.card-f .handle {
  transition: transform 0.3s ease-out, background-color 0.3s ease-out;
}

.card-f:hover .handle {
  transform: translateZ(40px) translateY(-5px);
  background-color: rgba(255, 219, 88,60%);
}

.card-f .emoji {
  display: inline-block;
  transition: transform 0.3s ease-out;
}

.card-f:hover .emoji {
  transform: translateZ(50px) rotate(15deg) scale(1.2);
}

@keyframes glitch {
  0% {
    clip-path: inset(50% 0 30% 0);
    transform: translate(-5px, 5px);
  }
  20% {
    clip-path: inset(10% 0 60% 0);
    transform: translate(5px, -5px);
  }
  40% {
    clip-path: inset(40% 0 20% 0);
    transform: translate(-5px, 5px);
  }
  60% {
    clip-path: inset(80% 0 5% 0);
    transform: translate(5px, -5px);
  }
  80% {
    clip-path: inset(15% 0 70% 0);
    transform: translate(-5px, 5px);
  }
  100% {
    clip-path: inset(50% 0 30% 0);
    transform: translate(5px, -5px);
  }
}

.card-f::after {
  content: attr(data-content);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  opacity: 0;
  z-index: -1;
}

.card-f:hover::after {
  opacity: 0.1;
}

</style>